<template>
	<div>
		这是商品列表页面
		<div v-for="(item,i) in productList" :key="i">
			<router-link :to="{path:'/productDetail',query:{id:item.id}}">
				<van-card :price="item.price" :desc="item.spec" :title="item.title" :thumb="item.img" />
			</router-link>
		</div>
	</div>
</template>

<script>
	import http from "@/utils/request.js";
	export default {
		data() {
			return {
				productList: []
			}
		},
		computed: {
			APIDomainName() {
				return import.meta.env.VITE_APIDomainName
			}
		},
		mounted() {
			this.loadData()
		},
		methods: {
			loadData() {
				// 调用接口
				http.request({
					url: "/product/page",
					method: "get",
				}).then(result => {
					console.log(result)
					this.productList = result.data;
				})
			}
		}
	}
</script>

<style>
</style>